
/*
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#include <stdio.h>

#include "libmooigraph.h"
#include "lmg.h"


static void lmg_1selfedge (struct lmgedgel *el);


void
lmg_selfedges (void)
{
  struct lmgedgel *eptr;
  eptr = lmgedgelist;
  while (eptr)
    {
      if (eptr->edge->from == eptr->edge->to)
	{
	  lmg_1selfedge (eptr);
	}
      eptr = eptr->next;
    }
  return;
}

static void
lmg_1selfedge (struct lmgedgel *el)
{
  struct lmgnode *node;
  struct lmgnodel *d1;
  struct lmgnodel *d2;
  struct lmgnodel *d3;
  struct lmgedgel *ell;
  node = el->edge->from;
  d1 = lmg_dummynode ();
  ell = lmg_addedge2 (node, d1->node);
  if (ell)
    {
    }
  d2 = lmg_dummynode ();
  ell = lmg_addedge2 (d1->node, d2->node);
  if (ell)
    {
    }
  d3 = lmg_dummynode ();
  ell = lmg_addedge2 (d2->node, d3->node);
  if (ell)
    {
    }
  ell = lmg_addedge2 (d3->node, node);
  return;
}

/* End */
